import 'package:car_map/widget/widget_agree_button.dart';
import 'package:car_map/widget/widget_realname_titlecount.dart';
import 'package:car_map/widget/widget_square_input.dart';
import 'package:flutter/material.dart';

///失信黑名单查询
class LostLetterBlackListPage extends StatefulWidget {
  @override
  _lostLetterBlackListState createState() => _lostLetterBlackListState();
}

class _lostLetterBlackListState extends State<LostLetterBlackListPage>
    with SingleTickerProviderStateMixin {

  List<Tab> tabList = [
    Tab(
      text: '个人',
    ),
    Tab(
      text: '企业',
    ),
  ];

  TabController controller;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    controller = new TabController(length: tabList.length, vsync: this);
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('失信黑名单'),
        bottom: TabBar(
          tabs: tabList,
          controller: controller,
          onTap: (int index) {},
        ),
      ),
      body: TabBarView(children: <Widget>[
        widgetPersonal(),
        widgetEnterprise()
      ],controller: controller,),
    );
  }

  //个人失信名单
  Widget widgetPersonal(){

    return Container(
      padding: EdgeInsets.only(left: 10.0,right: 10.0),
      child: ListView(
        children: <Widget>[
          WidgetRealNameTitleCount(title: '失信黑名单查询',contextValue: '查询个人是否在《失信名单》',),
          WidgetSquareInput(title: '姓名',hintText: '必填',textInputType: TextInputType.text,),
          WidgetSquareInput(title: '身份证号',hintText: '必填',textInputType: TextInputType.number,),
          WidgetSquareInput(title: '手机号码',hintText: '非必填',textInputType: TextInputType.phone,),
          WidgetSquareInput(title: '邮箱账号',hintText: '非必填',textInputType: TextInputType.emailAddress,),
          WidgetAgreeButton(terms: '我同意通过互联网查询，自愿承担风险',note: '注:查询失信黑名单需要支付2元，谢谢',),
        ],
      ),
    );
  }

  //企业失信名单
  Widget widgetEnterprise(){

    return Container(
      padding: EdgeInsets.only(left: 10.0,right: 10.0),
      child: ListView(
        children: <Widget>[
          WidgetRealNameTitleCount(title: '失信黑名单查询',contextValue: '查询企业是否在《失信名单》',),
          WidgetSquareInput(title: '姓名',hintText: '必填',textInputType: TextInputType.text,),
          WidgetSquareInput(title: '组织机构代码',hintText: '必填',textInputType: TextInputType.number,),
          WidgetSquareInput(title: '手机号码',hintText: '非必填',textInputType: TextInputType.phone,),
          WidgetSquareInput(title: '邮箱账号',hintText: '非必填',textInputType: TextInputType.emailAddress,),
          WidgetAgreeButton(terms: '我同意通过互联网查询，自愿承担风险',note: '注:查询失信黑名单需要支付2元，谢谢',),
        ],
      ),
    );
  }
}
